function reduceByKey(tuples,reduceCallback) {
    let grouped=_.groupBy(tuples,tuple=>tuple[0]);
    return _.toPairs(_.mapValues(grouped,tuples=>_.chain(tuples).map(tuple=>tuple[1]).reduce(reduceCallback).value()))
}

exports.reduceByKey=reduceByKey;